﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WF1.lab02
{
    public partial class frmSelectPicture : Form
    {
        frmAddNewProduct frm;
        public frmSelectPicture()
        {
            InitializeComponent();
        }

        public frmSelectPicture(frmAddNewProduct f)
        {
            InitializeComponent();
            frm = f;
        }

        private void frmSelectPicture_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < imgPicture.Images.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.ImageIndex = i;

                listPicture.Items.Add(item);
            }
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            frm.SelectPicture(imgPicture.Images[listPicture.SelectedItems[0].Index]);
            Close();
        }
    }
}
